#include <iostream>
using namespace std;

typedef long long LL;
LL a, h, b, k;
LL ret = 0;
int main()
{
    cin >> a >> h >> b >> k;

    LL n = min(h / b, k / a);

    ret += n * (a + b);

    h -= n * b;
    k -= n * a;

    if (h > 0 && k > 0)
    {
        h -= b;
        k -= a;
        ret += a + b;
    }

    if (h > 0 || k > 0)
    {
        ret += 10 * (h > 0 ? a : b);
    }

    cout << ret << endl;
    return 0;
}